package net.rlair.sbdemo.controller;

import net.rlair.sbdemo.dao.mybatis.bootmapper.UserMapper;
import net.rlair.sbdemo.entity.User;
import net.rlair.sbdemo.service.TxNestedZhouLiangjun;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lixudong
 */
@Controller
@RequestMapping("zhouliangjun")
public class ZhouliangjunController {

    @Resource
    private UserMapper userMapper;

    @Resource
    private TxNestedZhouLiangjun txNestedZhouLiangjun;

    @GetMapping("list")
    @ResponseBody
    public Object list() {
        final List<User> list = userMapper.selectUser();
        return list;
    }

    @GetMapping("batchInsert")
    @ResponseBody
    public Object json() {
        return txNestedZhouLiangjun.batchSave();
    }
}